<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%car}}".
 *
 * @property integer $id
 * @property string $car_type
 * @property double $price
 * @property string $car_no1
 * @property string $car_reg_no
 * @property string $shorp4s
 * @property string $car_no2
 *
 * @property DividedPaymentsOrder[] $dividedPaymentsOrders
 */
class Car extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%car}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['price'], 'number'],
            [['car_type', 'car_no1', 'car_reg_no', 'shorp4s'], 'string', 'max' => 100],
            [['car_no2'], 'string', 'max' => 20],
            [['car_no1'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'car_type' => 'Car Type',
            'price' => 'Price',
            'car_no1' => 'Car No1',
            'car_reg_no' => 'Car Reg No',
            'shorp4s' => 'Shorp4s',
            'car_no2' => 'Car No2',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getDividedPaymentsOrders()
    {
        return $this->hasMany(DividedPaymentsOrder::className(), ['car_id' => 'id']);
    }
}
